home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / JOHNLOVE / C_SOURCE / CMYPANE.C < prev    next >
Text File  |  1992-01-03  |  3KB  |  128 lines

  1. /*********************************************************
  2.  "CmyPane.c"
  3.  
  4.  by John A. Love, III [ Washington Apple Pi Users' Group]
  5.  
  6.  using Symantec's "THINK C", v 5.0.1
  7.  ... as derived from their "TCL Starter" files
  8.  *********************************************************/
  9.  
  10.  
  11.  
  12.  
  13. /*
  14. **  Most applications will want a scrollable window, so this
  15. **  class is based on the class CPanorama. All the methods here
  16. **  would still apply to classes based directly on CPane.
  17. */
  18.  
  19. #include "CmyGlobals.h"
  20. #include "CmyPane.h"
  21.  
  22.  
  23. void    CStarterPane::IStarterPane (CView *anEnclosure, CBureaucrat *aSupervisor,
  24.                                     short aWidth, short aHeight,
  25.                                     short aHEncl, short aVEncl,
  26.                                     SizingOption aHSizing, SizingOption aVSizing)    {
  27.                                 
  28.     CPanorama::IPanorama(anEnclosure, aSupervisor, aWidth, aHeight,
  29.                          aHEncl, aVEncl, aHSizing, aVSizing);
  30.                          
  31. }    /* IStarterPane */
  32.  
  33.  
  34.  
  35. /* Draw
  36. **
  37. **        In this method, you draw whatever you need to display in
  38. **        your pane. The area parameter gives the portion of the 
  39. **        pane that needs to be redrawn. Area is in frame coordinates.
  40. */
  41.  
  42. void    CStarterPane::Draw (Rect *area)        {
  43.  
  44.     /* draw your stuff */
  45.     
  46. }    /* Draw */
  47.  
  48.  
  49.  
  50. /* DoClick
  51. **
  52. **        The mouse went down in the pane.
  53. **        In this method you do whatever is appropriate for your
  54. **        application. HitPt is given in frame coordinates. The other
  55. **        parameters, modiferKeys and when, are taken from the event
  56. **        record.
  57. **
  58. **        If you want to implement mouse tracking, this is the method
  59. **        to do it in. You need to create a subclass of CMouseTask and
  60. **        pass it in a TrackMouse() message to the pane.
  61. */ 
  62.  
  63. void    CStarterPane::DoClick (Point hitPt, short modifierKeys, long when)    {
  64.  
  65.     // what happens when the mouse goes down:
  66.     
  67. }    /* DoClick */
  68.  
  69.  
  70. /* HitSamePart
  71. **
  72. **        Test whether pointA and pointB are in the same part.
  73. **        "The same part" means different things for different applications.
  74. **        In the default method, "the same part" means "in the same pane."
  75. **        If you want a different behavior, override this method. For instance,
  76. **        two points might be in the same part if they're within n pixels
  77. **      of each other.
  78. **
  79. **        PointA and pointB are both in frame coordinates.
  80. */
  81.  
  82. Boolean        CStarterPane::HitSamePart (Point pointA, Point pointB)        {
  83.  
  84.     return inherited::HitSamePart(pointA, pointB);
  85.     
  86. }    /* HitSamePart */
  87.  
  88.  
  89.  
  90. /* AdjustCursor
  91. **
  92. **        If you want the cursor to have a different shape in your pane,
  93. **        do it in this method. If you want a different cursor for different
  94. **        parts of the same pane, you'll need to change the mouseRgn like this:
  95. **            1. Create a region for the "special area" of your pane.
  96. **            2. Convert this region to global coordinates
  97. **            3. Set the mouseRgn to the intersection of this region
  98. **               and the original mouseRgn: SectRgn(mouseRgn, myRgn, mouseRgn);
  99. **
  100. **        The default method just sets the cursor to the arrow. If this is fine
  101. **        for you, don't override this method.
  102. */
  103.  
  104. void    CStarterPane::AdjustCursor(Point where, RgnHandle mouseRgn)        {
  105.  
  106.     inherited::AdjustCursor(where, mouseRgn);
  107.     
  108. }    /* AdjustCursor */
  109.  
  110.  
  111.  
  112. /* ScrollToSelection
  113. **
  114. **        If your pane is based on a Panorama (as this example is), you might
  115. **        want to define what it means to have a selection and what it means to
  116. **        scroll to that selection.
  117. */
  118.  
  119. void    CStarterPane::ScrollToSelection (void)    {
  120.  
  121.     // scroll to the selection:
  122.     
  123. }    /* ScrollToSelection */
  124.  
  125.  
  126.  
  127.  
  128. /* end: "CmyPane.c" */